<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="text" id="a" />

    <span id="b"></span>

    <script>
      const obj = {};
      const input = document.getElementById("a");
      const span = document.getElementById("b");
      input.addEventListener("keyup",(e)=>{
        obj.hello = e.target.value;
      })
      Object.defineProperty(obj, "hello", {
        get() {
          return obj.hello;
        },
        set(newVal) {
          input.value = newVal;
          span.innerHTML = newVal;
        },
      });
    </script>
  </body>
</html>
